package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.uuid.UUID;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.BieHouseholderMapper;
import com.ruoyi.system.domain.BieHouseholder;
import com.ruoyi.system.service.IBieHouseholderService;

/**
 * 住户Service业务层处理
 * 
 * @author zxl
 * @date 2021-05-03
 */
@Service
public class BieHouseholderServiceImpl implements IBieHouseholderService 
{
    @Autowired
    private BieHouseholderMapper bieHouseholderMapper;

    /**
     * 查询住户
     * 
     * @param holderId 住户ID
     * @return 住户
     */
    @Override
    public BieHouseholder selectBieHouseholderById(String holderId)
    {
        return bieHouseholderMapper.selectBieHouseholderById(holderId);
    }

    /**
     * 查询住户列表
     * 
     * @param bieHouseholder 住户
     * @return 住户
     */
    @Override
    public List<BieHouseholder> selectBieHouseholderList(BieHouseholder bieHouseholder)
    {
        return bieHouseholderMapper.selectBieHouseholderList(bieHouseholder);
    }

    /**
     * 新增住户
     * 
     * @param bieHouseholder 住户
     * @return 结果
     */
    @Override
    public int insertBieHouseholder(BieHouseholder bieHouseholder)
    {
        bieHouseholder.setHolderId(UUID.randomUUID().toString());
        bieHouseholder.setCreateTime(DateUtils.getNowDate());
        return bieHouseholderMapper.insertBieHouseholder(bieHouseholder);
    }

    /**
     * 修改住户
     * 
     * @param bieHouseholder 住户
     * @return 结果
     */
    @Override
    public int updateBieHouseholder(BieHouseholder bieHouseholder)
    {
        return bieHouseholderMapper.updateBieHouseholder(bieHouseholder);
    }

    /**
     * 批量删除住户
     * 
     * @param holderIds 需要删除的住户ID
     * @return 结果
     */
    @Override
    public int deleteBieHouseholderByIds(String[] holderIds)
    {
        return bieHouseholderMapper.deleteBieHouseholderByIds(holderIds);
    }

    /**
     * 删除住户信息
     * 
     * @param holderId 住户ID
     * @return 结果
     */
    @Override
    public int deleteBieHouseholderById(String holderId)
    {
        return bieHouseholderMapper.deleteBieHouseholderById(holderId);
    }
}
